<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="base.jsp"%>
<%@ page import="com.dom.info" %>
<%@ page import="java.util.*" %>
<%@ page import="java.text.DateFormat" %>
<%@ page import="java.text.SimpleDateFormat" %>
<!DOCTYPE html>
<html>
<head>
    <style type="text/css">
        body, html,#allmap {width: 100%;height: 100%;overflow: hidden;margin:0;font-family:"微软雅黑";}
    </style>
    <script type="text/javascript" src="//api.map.baidu.com/api?v=2.0&ak=Rh3GHAKgSgM8HNXgeSzpz6cjBuZ1hKNE"></script>
    <script type="text/javascript" src="js/baiduMap.js"></script>
    <title>地图展示</title>
</head>
<body>
<div>
    <div id="allmap" style="width: 80%; height: 100%; float: left">
        <script type="text/javascript">
            // 百度地图API功能
            var map = initMap();
        </script>
    </div>
    <div style="width: 20%; height: 100%; float: right">
        <h3>    灾情信息查看</h3>
        <%
            ArrayList data = (ArrayList) session.getAttribute("infos");
            for (int i = 0; i < data.size(); i++) {
                info temp = (info)data.get(i);
                DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
                String time = format.format(temp.getDate());
                String text = String.format("%s-%s-%s", temp.getName(), temp.getLocation(), time);
                String allText = String.format(
                        "申报人:%s;地点:%s;经度:%.3f;纬度%.3f;时间:%s;震感强度:%s;民众反应:%s;建筑物损害:%.3f%%;死亡人数:%d;受伤人数:%d;救援需求:%s:供电情况:%s;通信情况:%s;交通情况:%s;供水情况:%s;供气情况:%s;",
                        temp.getName(), temp.getLocation(), temp.getLon(), temp.getLat(), time, temp.getDegree(), temp.getReaction(), temp.getDestory(), temp.getDead(), temp.getHurt(), temp.getAid(), temp.getElec(), temp.getConcat(), temp.getTraffic(), temp.getWater(), temp.getGas());
        %>
        <ul><li><a onclick="addInfo(map, new BMap.Point(<%=temp.getLon()%>, <%=temp.getLat()%>), '<%=allText%>')"><%=text%></a></li></ul>
        <%}%>
    </div>
</div>
</body>
</html>

